﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;

namespace livingwellclinic
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            NameTextBox.Enabled = true;
            middleintialtxt.Enabled = true;
            lastnametxt.Enabled = true;
            Address1TextBox.Enabled = true;
            Address2TextBox.Enabled = true;
            CityTextBox.Enabled = true;
            DropDownListState.Enabled = true;
            ZIPTextBox.Enabled = true;
            PhoneTextBox.Enabled = true;
            if (!IsPostBack)
            {
                DropDownListState.SelectedIndex = 0;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (DropDownListState.SelectedIndex == 0)
            {
                ddlvad.IsValid = false;

            }
            else
            {
                ddlvad.IsValid = true;

                UserProfiles profile = UserProfiles.GetUserProfile();
                profile.FirstName = NameTextBox.Text;
                profile.MiddleIntial = middleintialtxt.Text;
                profile.LastName = lastnametxt.Text;
                profile.Address = Address1TextBox.Text;
                profile.Address2 = Address2TextBox.Text;
                profile.City = CityTextBox.Text;
                profile.State = Convert.ToString(DropDownListState.SelectedValue);
                profile.Zip = ZIPTextBox.Text;
                profile.Phone = PhoneTextBox.Text;
                // Text to confirm user of information storage, hopefully can be changed into a dialogue box
                lblinformation.Text = "Your information has been saved. </br> Please Navigate Away from page at your own leisure.";
                // Disables User messing with the page, after information was stored
                NameTextBox.Enabled = false;
                middleintialtxt.Enabled = false;
                lastnametxt.Enabled = false;
                Address1TextBox.Enabled = false;
                Address2TextBox.Enabled = false;
                CityTextBox.Enabled = false;
                DropDownListState.Enabled = false;
                ZIPTextBox.Enabled = false;
                PhoneTextBox.Enabled = false;
            }

           
            
        }
       
    }
}